package com.dhu.cst.ningtianzhe181310419.test;

import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.widget.AppCompatTextView;

import androidx.appcompat.app.AppCompatActivity;

public class ShowActivity extends AppCompatActivity {
    private TextView nameShow;
    private TextView schoolShow;
    private TextView localeShow;
    public SharedPreferences sharedPreferences;

    public static String name;
    public static String school;
    public static String locale;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show);
        this.getSupportActionBar().hide();
        initView();
        setDataFromInfo();
    }
    public void initView(){
        nameShow = this.findViewById(R.id.nameShow);
        schoolShow = this.findViewById(R.id.schoolShow);
        localeShow = this.findViewById(R.id.localeShow);
        sharedPreferences = getSharedPreferences("info",MODE_PRIVATE);
    }

    public void backToMain(View view){
        Intent intent = new Intent();
        intent.setClass(ShowActivity.this,MainActivity.class);
        ShowActivity.this.startActivity(intent);
    }
    public void change(View view){
        Intent intent = new Intent();
        intent.setClass(ShowActivity.this,ChangeActivity.class);
        ShowActivity.this.startActivity(intent);
    }

    //从数据库中获取修改过的信息
    public void setDataFromInfo(){
        name = Info.name;
        school = Info.school;
        locale = Info.address;
        if(name!=null&&school!=null&&locale!=null){
            nameShow.setText(name);
            schoolShow.setText(school);
            localeShow.setText(locale);
        }
    }
}
